home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gcc_260.zip / gcc_260 / gcc.info-13 (.txt) < prev    next >
GNU Info File  |  1994-07-14  |  45KB  |  787 lines

  1. This is Info file gcc.info, produced by Makeinfo-1.54 from the input
  2. file gcc.texi.
  3.    This file documents the use and the internals of the GNU compiler.
  4.    Published by the Free Software Foundation 675 Massachusetts Avenue
  5. Cambridge, MA 02139 USA
  6.    Copyright (C) 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  7.    Permission is granted to make and distribute verbatim copies of this
  8. manual provided the copyright notice and this permission notice are
  9. preserved on all copies.
  10.    Permission is granted to copy and distribute modified versions of
  11. this manual under the conditions for verbatim copying, provided also
  12. that the sections entitled "GNU General Public License" and "Protect
  13. Your Freedom--Fight `Look And Feel'" are included exactly as in the
  14. original, and provided that the entire resulting derived work is
  15. distributed under the terms of a permission notice identical to this
  16.    Permission is granted to copy and distribute translations of this
  17. manual into another language, under the above conditions for modified
  18. versions, except that the sections entitled "GNU General Public
  19. License" and "Protect Your Freedom--Fight `Look And Feel'", and this
  20. permission notice, may be included in translations approved by the Free
  21. Software Foundation instead of in the original English.
  22. File: gcc.info,  Node: Regs and Memory,  Next: Arithmetic,  Prev: Constants,  Up: RTL
  23. Registers and Memory
  24. ====================
  25.    Here are the RTL expression types for describing access to machine
  26. registers and to main memory.
  27. `(reg:M N)'
  28.      For small values of the integer N (those that are less than
  29.      `FIRST_PSEUDO_REGISTER'), this stands for a reference to machine
  30.      register number N: a "hard register".  For larger values of N, it
  31.      stands for a temporary value or "pseudo register".  The compiler's
  32.      strategy is to generate code assuming an unlimited number of such
  33.      pseudo registers, and later convert them into hard registers or
  34.      into memory references.
  35.      M is the machine mode of the reference.  It is necessary because
  36.      machines can generally refer to each register in more than one
  37.      mode.  For example, a register may contain a full word but there
  38.      may be instructions to refer to it as a half word or as a single
  39.      byte, as well as instructions to refer to it as a floating point
  40.      number of various precisions.
  41.      Even for a register that the machine can access in only one mode,
  42.      the mode must always be specified.
  43.      The symbol `FIRST_PSEUDO_REGISTER' is defined by the machine
  44.      description, since the number of hard registers on the machine is
  45.      an invariant characteristic of the machine.  Note, however, that
  46.      not all of the machine registers must be general registers.  All
  47.      the machine registers that can be used for storage of data are
  48.      given hard register numbers, even those that can be used only in
  49.      certain instructions or can hold only certain types of data.
  50.      A hard register may be accessed in various modes throughout one
  51.      function, but each pseudo register is given a natural mode and is
  52.      accessed only in that mode.  When it is necessary to describe an
  53.      access to a pseudo register using a nonnatural mode, a `subreg'
  54.      expression is used.
  55.      A `reg' expression with a machine mode that specifies more than
  56.      one word of data may actually stand for several consecutive
  57.      registers.  If in addition the register number specifies a
  58.      hardware register, then it actually represents several consecutive
  59.      hardware registers starting with the specified one.
  60.      Each pseudo register number used in a function's RTL code is
  61.      represented by a unique `reg' expression.
  62.      Some pseudo register numbers, those within the range of
  63.      `FIRST_VIRTUAL_REGISTER' to `LAST_VIRTUAL_REGISTER' only appear
  64.      during the RTL generation phase and are eliminated before the
  65.      optimization phases.  These represent locations in the stack frame
  66.      that cannot be determined until RTL generation for the function
  67.      has been completed.  The following virtual register numbers are
  68.      defined:
  69.     `VIRTUAL_INCOMING_ARGS_REGNUM'
  70.           This points to the first word of the incoming arguments
  71.           passed on the stack.  Normally these arguments are placed
  72.           there by the caller, but the callee may have pushed some
  73.           arguments that were previously passed in registers.
  74.           When RTL generation is complete, this virtual register is
  75.           replaced by the sum of the register given by
  76.           `ARG_POINTER_REGNUM' and the value of `FIRST_PARM_OFFSET'.
  77.     `VIRTUAL_STACK_VARS_REGNUM'
  78.           If `FRAME_GROWS_DOWNWARD' is defined, this points to
  79.           immediately above the first variable on the stack.
  80.           Otherwise, it points to the first variable on the stack.
  81.           `VIRTUAL_STACK_VARS_REGNUM' is replaced with the sum of the
  82.           register given by `FRAME_POINTER_REGNUM' and the value
  83.           `STARTING_FRAME_OFFSET'.
  84.     `VIRTUAL_STACK_DYNAMIC_REGNUM'
  85.           This points to the location of dynamically allocated memory
  86.           on the stack immediately after the stack pointer has been
  87.           adjusted by the amount of memory desired.
  88.           This virtual register is replaced by the sum of the register
  89.           given by `STACK_POINTER_REGNUM' and the value
  90.           `STACK_DYNAMIC_OFFSET'.
  91.     `VIRTUAL_OUTGOING_ARGS_REGNUM'
  92.           This points to the location in the stack at which outgoing
  93.           arguments should be written when the stack is pre-pushed
  94.           (arguments pushed using push insns should always use
  95.           `STACK_POINTER_REGNUM').
  96.           This virtual register is replaced by the sum of the register
  97.           given by `STACK_POINTER_REGNUM' and the value
  98.           `STACK_POINTER_OFFSET'.
  99. `(subreg:M REG WORDNUM)'
  100.      `subreg' expressions are used to refer to a register in a machine
  101.      mode other than its natural one, or to refer to one register of a
  102.      multi-word `reg' that actually refers to several registers.
  103.      Each pseudo-register has a natural mode.  If it is necessary to
  104.      operate on it in a different mode--for example, to perform a
  105.      fullword move instruction on a pseudo-register that contains a
  106.      single byte--the pseudo-register must be enclosed in a `subreg'.
  107.      In such a case, WORDNUM is zero.
  108.      Usually M is at least as narrow as the mode of REG, in which case
  109.      it is restricting consideration to only the bits of REG that are
  110.      in M.
  111.      Sometimes M is wider than the mode of REG.  These `subreg'
  112.      expressions are often called "paradoxical".  They are used in
  113.      cases where we want to refer to an object in a wider mode but do
  114.      not care what value the additional bits have.  The reload pass
  115.      ensures that paradoxical references are only made to hard
  116.      registers.
  117.      The other use of `subreg' is to extract the individual registers of
  118.      a multi-register value.  Machine modes such as `DImode' and
  119.      `TImode' can indicate values longer than a word, values which
  120.      usually require two or more consecutive registers.  To access one
  121.      of the registers, use a `subreg' with mode `SImode' and a WORDNUM
  122.      that says which register.
  123.      Storing in a non-paradoxical `subreg' has undefined results for
  124.      bits belonging to the same word as the `subreg'.  This laxity makes
  125.      it easier to generate efficient code for such instructions.  To
  126.      represent an instruction that preserves all the bits outside of
  127.      those in the `subreg', use `strict_low_part' around the `subreg'.
  128.      The compilation parameter `WORDS_BIG_ENDIAN', if set to 1, says
  129.      that word number zero is the most significant part; otherwise, it
  130.      is the least significant part.
  131.      Between the combiner pass and the reload pass, it is possible to
  132.      have a paradoxical `subreg' which contains a `mem' instead of a
  133.      `reg' as its first operand.  After the reload pass, it is also
  134.      possible to have a non-paradoxical `subreg' which contains a
  135.      `mem'; this usually occurs when the `mem' is a stack slot which
  136.      replaced a pseudo register.
  137.      Note that it is not valid to access a `DFmode' value in `SFmode'
  138.      using a `subreg'.  On some machines the most significant part of a
  139.      `DFmode' value does not have the same format as a single-precision
  140.      floating value.
  141.      It is also not valid to access a single word of a multi-word value
  142.      in a hard register when less registers can hold the value than
  143.      would be expected from its size.  For example, some 32-bit
  144.      machines have floating-point registers that can hold an entire
  145.      `DFmode' value.  If register 10 were such a register `(subreg:SI
  146.      (reg:DF 10) 1)' would be invalid because there is no way to
  147.      convert that reference to a single machine register.  The reload
  148.      pass prevents `subreg' expressions such as these from being formed.
  149.      The first operand of a `subreg' expression is customarily accessed
  150.      with the `SUBREG_REG' macro and the second operand is customarily
  151.      accessed with the `SUBREG_WORD' macro.
  152. `(scratch:M)'
  153.      This represents a scratch register that will be required for the
  154.      execution of a single instruction and not used subsequently.  It is
  155.      converted into a `reg' by either the local register allocator or
  156.      the reload pass.
  157.      `scratch' is usually present inside a `clobber' operation (*note
  158.      Side Effects::.).
  159. `(cc0)'
  160.      This refers to the machine's condition code register.  It has no
  161.      operands and may not have a machine mode.  There are two ways to
  162.      use it:
  163.         * To stand for a complete set of condition code flags.  This is
  164.           best on most machines, where each comparison sets the entire
  165.           series of flags.
  166.           With this technique, `(cc0)' may be validly used in only two
  167.           contexts: as the destination of an assignment (in test and
  168.           compare instructions) and in comparison operators comparing
  169.           against zero (`const_int' with value zero; that is to say,
  170.           `const0_rtx').
  171.         * To stand for a single flag that is the result of a single
  172.           condition.  This is useful on machines that have only a
  173.           single flag bit, and in which comparison instructions must
  174.           specify the condition to test.
  175.           With this technique, `(cc0)' may be validly used in only two
  176.           contexts: as the destination of an assignment (in test and
  177.           compare instructions) where the source is a comparison
  178.           operator, and as the first operand of `if_then_else' (in a
  179.           conditional branch).
  180.      There is only one expression object of code `cc0'; it is the value
  181.      of the variable `cc0_rtx'.  Any attempt to create an expression of
  182.      code `cc0' will return `cc0_rtx'.
  183.      Instructions can set the condition code implicitly.  On many
  184.      machines, nearly all instructions set the condition code based on
  185.      the value that they compute or store.  It is not necessary to
  186.      record these actions explicitly in the RTL because the machine
  187.      description includes a prescription for recognizing the
  188.      instructions that do so (by means of the macro
  189.      `NOTICE_UPDATE_CC').  *Note Condition Code::.  Only instructions
  190.      whose sole purpose is to set the condition code, and instructions
  191.      that use the condition code, need mention `(cc0)'.
  192.      On some machines, the condition code register is given a register
  193.      number and a `reg' is used instead of `(cc0)'.  This is usually the
  194.      preferable approach if only a small subset of instructions modify
  195.      the condition code.  Other machines store condition codes in
  196.      general registers; in such cases a pseudo register should be used.
  197.      Some machines, such as the Sparc and RS/6000, have two sets of
  198.      arithmetic instructions, one that sets and one that does not set
  199.      the condition code.  This is best handled by normally generating
  200.      the instruction that does not set the condition code, and making a
  201.      pattern that both performs the arithmetic and sets the condition
  202.      code register (which would not be `(cc0)' in this case).  For
  203.      examples, search for `addcc' and `andcc' in `sparc.md'.
  204. `(pc)'
  205.      This represents the machine's program counter.  It has no operands
  206.      and may not have a machine mode.  `(pc)' may be validly used only
  207.      in certain specific contexts in jump instructions.
  208.      There is only one expression object of code `pc'; it is the value
  209.      of the variable `pc_rtx'.  Any attempt to create an expression of
  210.      code `pc' will return `pc_rtx'.
  211.      All instructions that do not jump alter the program counter
  212.      implicitly by incrementing it, but there is no need to mention
  213.      this in the RTL.
  214. `(mem:M ADDR)'
  215.      This RTX represents a reference to main memory at an address
  216.      represented by the expression ADDR.  M specifies how large a unit
  217.      of memory is accessed.
  218. File: gcc.info,  Node: Arithmetic,  Next: Comparisons,  Prev: Regs and Memory,  Up: RTL
  219. RTL Expressions for Arithmetic
  220. ==============================
  221.    Unless otherwise specified, all the operands of arithmetic
  222. expressions must be valid for mode M.  An operand is valid for mode M
  223. if it has mode M, or if it is a `const_int' or `const_double' and M is
  224. a mode of class `MODE_INT'.
  225.    For commutative binary operations, constants should be placed in the
  226. second operand.
  227. `(plus:M X Y)'
  228.      Represents the sum of the values represented by X and Y carried
  229.      out in machine mode M.
  230. `(lo_sum:M X Y)'
  231.      Like `plus', except that it represents that sum of X and the
  232.      low-order bits of Y.  The number of low order bits is
  233.      machine-dependent but is normally the number of bits in a `Pmode'
  234.      item minus the number of bits set by the `high' code (*note
  235.      Constants::.).
  236.      M should be `Pmode'.
  237. `(minus:M X Y)'
  238.      Like `plus' but represents subtraction.
  239. `(compare:M X Y)'
  240.      Represents the result of subtracting Y from X for purposes of
  241.      comparison.  The result is computed without overflow, as if with
  242.      infinite precision.
  243.      Of course, machines can't really subtract with infinite precision.
  244.      However, they can pretend to do so when only the sign of the
  245.      result will be used, which is the case when the result is stored
  246.      in the condition code.   And that is the only way this kind of
  247.      expression may validly be used: as a value to be stored in the
  248.      condition codes.
  249.      The mode M is not related to the modes of X and Y, but instead is
  250.      the mode of the condition code value.  If `(cc0)' is used, it is
  251.      `VOIDmode'.  Otherwise it is some mode in class `MODE_CC', often
  252.      `CCmode'.  *Note Condition Code::.
  253.      Normally, X and Y must have the same mode.  Otherwise, `compare'
  254.      is valid only if the mode of X is in class `MODE_INT' and Y is a
  255.      `const_int' or `const_double' with mode `VOIDmode'.  The mode of X
  256.      determines what mode the comparison is to be done in; thus it must
  257.      not be `VOIDmode'.
  258.      If one of the operands is a constant, it should be placed in the
  259.      second operand and the comparison code adjusted as appropriate.
  260.      A `compare' specifying two `VOIDmode' constants is not valid since
  261.      there is no way to know in what mode the comparison is to be
  262.      performed; the comparison must either be folded during the
  263.      compilation or the first operand must be loaded into a register
  264.      while its mode is still known.
  265. `(neg:M X)'
  266.      Represents the negation (subtraction from zero) of the value
  267.      represented by X, carried out in mode M.
  268. `(mult:M X Y)'
  269.      Represents the signed product of the values represented by X and Y
  270.      carried out in machine mode M.
  271.      Some machines support a multiplication that generates a product
  272.      wider than the operands.  Write the pattern for this as
  273.           (mult:M (sign_extend:M X) (sign_extend:M Y))
  274.      where M is wider than the modes of X and Y, which need not be the
  275.      same.
  276.      Write patterns for unsigned widening multiplication similarly using
  277.      `zero_extend'.
  278. `(div:M X Y)'
  279.      Represents the quotient in signed division of X by Y, carried out
  280.      in machine mode M.  If M is a floating point mode, it represents
  281.      the exact quotient; otherwise, the integerized quotient.
  282.      Some machines have division instructions in which the operands and
  283.      quotient widths are not all the same; you should represent such
  284.      instructions using `truncate' and `sign_extend' as in,
  285.           (truncate:M1 (div:M2 X (sign_extend:M2 Y)))
  286. `(udiv:M X Y)'
  287.      Like `div' but represents unsigned division.
  288. `(mod:M X Y)'
  289. `(umod:M X Y)'
  290.      Like `div' and `udiv' but represent the remainder instead of the
  291.      quotient.
  292. `(smin:M X Y)'
  293. `(smax:M X Y)'
  294.      Represents the smaller (for `smin') or larger (for `smax') of X
  295.      and Y, interpreted as signed integers in mode M.
  296. `(umin:M X Y)'
  297. `(umax:M X Y)'
  298.      Like `smin' and `smax', but the values are interpreted as unsigned
  299.      integers.
  300. `(not:M X)'
  301.      Represents the bitwise complement of the value represented by X,
  302.      carried out in mode M, which must be a fixed-point machine mode.
  303. `(and:M X Y)'
  304.      Represents the bitwise logical-and of the values represented by X
  305.      and Y, carried out in machine mode M, which must be a fixed-point
  306.      machine mode.
  307. `(ior:M X Y)'
  308.      Represents the bitwise inclusive-or of the values represented by X
  309.      and Y, carried out in machine mode M, which must be a fixed-point
  310.      mode.
  311. `(xor:M X Y)'
  312.      Represents the bitwise exclusive-or of the values represented by X
  313.      and Y, carried out in machine mode M, which must be a fixed-point
  314.      mode.
  315. `(ashift:M X C)'
  316.      Represents the result of arithmetically shifting X left by C
  317.      places.  X have mode M, a fixed-point machine mode.  C be a
  318.      fixed-point mode or be a constant with mode `VOIDmode'; which mode
  319.      is determined by the mode called for in the machine description
  320.      entry for the left-shift instruction.  For example, on the Vax,
  321.      the mode of C is `QImode' regardless of M.
  322. `(lshiftrt:M X C)'
  323. `(ashiftrt:M X C)'
  324.      Like `ashift' but for right shift.  Unlike the case for left shift,
  325.      these two operations are distinct.
  326. `(rotate:M X C)'
  327. `(rotatert:M X C)'
  328.      Similar but represent left and right rotate.  If C is a constant,
  329.      use `rotate'.
  330. `(abs:M X)'
  331.      Represents the absolute value of X, computed in mode M.
  332. `(sqrt:M X)'
  333.      Represents the square root of X, computed in mode M.  Most often M
  334.      will be a floating point mode.
  335. `(ffs:M X)'
  336.      Represents one plus the index of the least significant 1-bit in X,
  337.      represented as an integer of mode M.  (The value is zero if X is
  338.      zero.)  The mode of X need not be M; depending on the target
  339.      machine, various mode combinations may be valid.
  340. File: gcc.info,  Node: Comparisons,  Next: Bit Fields,  Prev: Arithmetic,  Up: RTL
  341. Comparison Operations
  342. =====================
  343.    Comparison operators test a relation on two operands and are
  344. considered to represent a machine-dependent nonzero value described by,
  345. but not necessarily equal to, `STORE_FLAG_VALUE' (*note Misc::.) if the
  346. relation holds, or zero if it does not.  The mode of the comparison
  347. operation is independent of the mode of the data being compared.  If
  348. the comparison operation is being tested (e.g., the first operand of an
  349. `if_then_else'), the mode must be `VOIDmode'.  If the comparison
  350. operation is producing data to be stored in some variable, the mode
  351. must be in class `MODE_INT'.  All comparison operations producing data
  352. must use the same mode, which is machine-specific.
  353.    There are two ways that comparison operations may be used.  The
  354. comparison operators may be used to compare the condition codes `(cc0)'
  355. against zero, as in `(eq (cc0) (const_int 0))'.  Such a construct
  356. actually refers to the result of the preceding instruction in which the
  357. condition codes were set.  The instructing setting the condition code
  358. must be adjacent to the instruction using the condition code; only
  359. `note' insns may separate them.
  360.    Alternatively, a comparison operation may directly compare two data
  361. objects.  The mode of the comparison is determined by the operands; they
  362. must both be valid for a common machine mode.  A comparison with both
  363. operands constant would be invalid as the machine mode could not be
  364. deduced from it, but such a comparison should never exist in RTL due to
  365. constant folding.
  366.    In the example above, if `(cc0)' were last set to `(compare X Y)',
  367. the comparison operation is identical to `(eq X Y)'.  Usually only one
  368. style of comparisons is supported on a particular machine, but the
  369. combine pass will try to merge the operations to produce the `eq' shown
  370. in case it exists in the context of the particular insn involved.
  371.    Inequality comparisons come in two flavors, signed and unsigned.
  372. Thus, there are distinct expression codes `gt' and `gtu' for signed and
  373. unsigned greater-than.  These can produce different results for the same
  374. pair of integer values: for example, 1 is signed greater-than -1 but not
  375. unsigned greater-than, because -1 when regarded as unsigned is actually
  376. `0xffffffff' which is greater than 1.
  377.    The signed comparisons are also used for floating point values.
  378. Floating point comparisons are distinguished by the machine modes of
  379. the operands.
  380. `(eq:M X Y)'
  381.      1 if the values represented by X and Y are equal, otherwise 0.
  382. `(ne:M X Y)'
  383.      1 if the values represented by X and Y are not equal, otherwise 0.
  384. `(gt:M X Y)'
  385.      1 if the X is greater than Y.  If they are fixed-point, the
  386.      comparison is done in a signed sense.
  387. `(gtu:M X Y)'
  388.      Like `gt' but does unsigned comparison, on fixed-point numbers
  389.      only.
  390. `(lt:M X Y)'
  391. `(ltu:M X Y)'
  392.      Like `gt' and `gtu' but test for "less than".
  393. `(ge:M X Y)'
  394. `(geu:M X Y)'
  395.      Like `gt' and `gtu' but test for "greater than or equal".
  396. `(le:M X Y)'
  397. `(leu:M X Y)'
  398.      Like `gt' and `gtu' but test for "less than or equal".
  399. `(if_then_else COND THEN ELSE)'
  400.      This is not a comparison operation but is listed here because it is
  401.      always used in conjunction with a comparison operation.  To be
  402.      precise, COND is a comparison expression.  This expression
  403.      represents a choice, according to COND, between the value
  404.      represented by THEN and the one represented by ELSE.
  405.      On most machines, `if_then_else' expressions are valid only to
  406.      express conditional jumps.
  407. `(cond [TEST1 VALUE1 TEST2 VALUE2 ...] DEFAULT)'
  408.      Similar to `if_then_else', but more general.  Each of TEST1,
  409.      TEST2, ... is performed in turn.  The result of this expression is
  410.      the VALUE corresponding to the first non-zero test, or DEFAULT if
  411.      none of the tests are non-zero expressions.
  412.      This is currently not valid for instruction patterns and is
  413.      supported only for insn attributes.  *Note Insn Attributes::.
  414. File: gcc.info,  Node: Bit Fields,  Next: Conversions,  Prev: Comparisons,  Up: RTL
  415. Bit Fields
  416. ==========
  417.    Special expression codes exist to represent bitfield instructions.
  418. These types of expressions are lvalues in RTL; they may appear on the
  419. left side of an assignment, indicating insertion of a value into the
  420. specified bit field.
  421. `(sign_extract:M LOC SIZE POS)'
  422.      This represents a reference to a sign-extended bit field contained
  423.      or starting in LOC (a memory or register reference).  The bit field
  424.      is SIZE bits wide and starts at bit POS.  The compilation option
  425.      `BITS_BIG_ENDIAN' says which end of the memory unit POS counts
  426.      from.
  427.      If LOC is in memory, its mode must be a single-byte integer mode.
  428.      If LOC is in a register, the mode to use is specified by the
  429.      operand of the `insv' or `extv' pattern (*note Standard Names::.)
  430.      and is usually a full-word integer mode.
  431.      The mode of POS is machine-specific and is also specified in the
  432.      `insv' or `extv' pattern.
  433.      The mode M is the same as the mode that would be used for LOC if
  434.      it were a register.
  435. `(zero_extract:M LOC SIZE POS)'
  436.      Like `sign_extract' but refers to an unsigned or zero-extended bit
  437.      field.  The same sequence of bits are extracted, but they are
  438.      filled to an entire word with zeros instead of by sign-extension.
  439. File: gcc.info,  Node: Conversions,  Next: RTL Declarations,  Prev: Bit Fields,  Up: RTL
  440. Conversions
  441. ===========
  442.    All conversions between machine modes must be represented by
  443. explicit conversion operations.  For example, an expression which is
  444. the sum of a byte and a full word cannot be written as `(plus:SI
  445. (reg:QI 34) (reg:SI 80))' because the `plus' operation requires two
  446. operands of the same machine mode.  Therefore, the byte-sized operand
  447. is enclosed in a conversion operation, as in
  448.      (plus:SI (sign_extend:SI (reg:QI 34)) (reg:SI 80))
  449.    The conversion operation is not a mere placeholder, because there
  450. may be more than one way of converting from a given starting mode to
  451. the desired final mode.  The conversion operation code says how to do
  452.    For all conversion operations, X must not be `VOIDmode' because the
  453. mode in which to do the conversion would not be known.  The conversion
  454. must either be done at compile-time or X must be placed into a register.
  455. `(sign_extend:M X)'
  456.      Represents the result of sign-extending the value X to machine
  457.      mode M.  M must be a fixed-point mode and X a fixed-point value of
  458.      a mode narrower than M.
  459. `(zero_extend:M X)'
  460.      Represents the result of zero-extending the value X to machine
  461.      mode M.  M must be a fixed-point mode and X a fixed-point value of
  462.      a mode narrower than M.
  463. `(float_extend:M X)'
  464.      Represents the result of extending the value X to machine mode M.
  465.      m must be a floating point mode and X a floating point value of a
  466.      mode narrower than M.
  467. `(truncate:M X)'
  468.      Represents the result of truncating the value X to machine mode M.
  469.      M must be a fixed-point mode and X a fixed-point value of a mode
  470.      wider than M.
  471. `(float_truncate:M X)'
  472.      Represents the result of truncating the value X to machine mode M.
  473.      M must be a floating point mode and X a floating point value of a
  474.      mode wider than M.
  475. `(float:M X)'
  476.      Represents the result of converting fixed point value X, regarded
  477.      as signed, to floating point mode M.
  478. `(unsigned_float:M X)'
  479.      Represents the result of converting fixed point value X, regarded
  480.      as unsigned, to floating point mode M.
  481. `(fix:M X)'
  482.      When M is a fixed point mode, represents the result of converting
  483.      floating point value X to mode M, regarded as signed.  How
  484.      rounding is done is not specified, so this operation may be used
  485.      validly in compiling C code only for integer-valued operands.
  486. `(unsigned_fix:M X)'
  487.      Represents the result of converting floating point value X to
  488.      fixed point mode M, regarded as unsigned.  How rounding is done is
  489.      not specified.
  490. `(fix:M X)'
  491.      When M is a floating point mode, represents the result of
  492.      converting floating point value X (valid for mode M) to an
  493.      integer, still represented in floating point mode M, by rounding
  494.      towards zero.
  495. File: gcc.info,  Node: RTL Declarations,  Next: Side Effects,  Prev: Conversions,  Up: RTL
  496. Declarations
  497. ============
  498.    Declaration expression codes do not represent arithmetic operations
  499. but rather state assertions about their operands.
  500. `(strict_low_part (subreg:M (reg:N R) 0))'
  501.      This expression code is used in only one context: as the
  502.      destination operand of a `set' expression.  In addition, the
  503.      operand of this expression must be a non-paradoxical `subreg'
  504.      expression.
  505.      The presence of `strict_low_part' says that the part of the
  506.      register which is meaningful in mode N, but is not part of mode M,
  507.      is not to be altered.  Normally, an assignment to such a subreg is
  508.      allowed to have undefined effects on the rest of the register when
  509.      M is less than a word.
  510. File: gcc.info,  Node: Side Effects,  Next: Incdec,  Prev: RTL Declarations,  Up: RTL
  511. Side Effect Expressions
  512. =======================
  513.    The expression codes described so far represent values, not actions.
  514. But machine instructions never produce values; they are meaningful only
  515. for their side effects on the state of the machine.  Special expression
  516. codes are used to represent side effects.
  517.    The body of an instruction is always one of these side effect codes;
  518. the codes described above, which represent values, appear only as the
  519. operands of these.
  520. `(set LVAL X)'
  521.      Represents the action of storing the value of X into the place
  522.      represented by LVAL.  LVAL must be an expression representing a
  523.      place that can be stored in: `reg' (or `subreg' or
  524.      `strict_low_part'), `mem', `pc' or `cc0'.
  525.      If LVAL is a `reg', `subreg' or `mem', it has a machine mode; then
  526.      X must be valid for that mode.
  527.      If LVAL is a `reg' whose machine mode is less than the full width
  528.      of the register, then it means that the part of the register
  529.      specified by the machine mode is given the specified value and the
  530.      rest of the register receives an undefined value.  Likewise, if
  531.      LVAL is a `subreg' whose machine mode is narrower than the mode of
  532.      the register, the rest of the register can be changed in an
  533.      undefined way.
  534.      If LVAL is a `strict_low_part' of a `subreg', then the part of the
  535.      register specified by the machine mode of the `subreg' is given
  536.      the value X and the rest of the register is not changed.
  537.      If LVAL is `(cc0)', it has no machine mode, and X may be either a
  538.      `compare' expression or a value that may have any mode.  The
  539.      latter case represents a "test" instruction.  The expression `(set
  540.      (cc0) (reg:M N))' is equivalent to `(set (cc0) (compare (reg:M N)
  541.      (const_int 0)))'.  Use the former expression to save space during
  542.      the compilation.
  543.      If LVAL is `(pc)', we have a jump instruction, and the
  544.      possibilities for X are very limited.  It may be a `label_ref'
  545.      expression (unconditional jump).  It may be an `if_then_else'
  546.      (conditional jump), in which case either the second or the third
  547.      operand must be `(pc)' (for the case which does not jump) and the
  548.      other of the two must be a `label_ref' (for the case which does
  549.      jump).  X may also be a `mem' or `(plus:SI (pc) Y)', where Y may
  550.      be a `reg' or a `mem'; these unusual patterns are used to
  551.      represent jumps through branch tables.
  552.      If LVAL is neither `(cc0)' nor `(pc)', the mode of LVAL must not
  553.      be `VOIDmode' and the mode of X must be valid for the mode of LVAL.
  554.      LVAL is customarily accessed with the `SET_DEST' macro and X with
  555.      the `SET_SRC' macro.
  556. `(return)'
  557.      As the sole expression in a pattern, represents a return from the
  558.      current function, on machines where this can be done with one
  559.      instruction, such as Vaxes.  On machines where a multi-instruction
  560.      "epilogue" must be executed in order to return from the function,
  561.      returning is done by jumping to a label which precedes the
  562.      epilogue, and the `return' expression code is never used.
  563.      Inside an `if_then_else' expression, represents the value to be
  564.      placed in `pc' to return to the caller.
  565.      Note that an insn pattern of `(return)' is logically equivalent to
  566.      `(set (pc) (return))', but the latter form is never used.
  567. `(call FUNCTION NARGS)'
  568.      Represents a function call.  FUNCTION is a `mem' expression whose
  569.      address is the address of the function to be called.  NARGS is an
  570.      expression which can be used for two purposes: on some machines it
  571.      represents the number of bytes of stack argument; on others, it
  572.      represents the number of argument registers.
  573.      Each machine has a standard machine mode which FUNCTION must have.
  574.      The machine description defines macro `FUNCTION_MODE' to expand
  575.      into the requisite mode name.  The purpose of this mode is to
  576.      specify what kind of addressing is allowed, on machines where the
  577.      allowed kinds of addressing depend on the machine mode being
  578.      addressed.
  579. `(clobber X)'
  580.      Represents the storing or possible storing of an unpredictable,
  581.      undescribed value into X, which must be a `reg', `scratch' or
  582.      `mem' expression.
  583.      One place this is used is in string instructions that store
  584.      standard values into particular hard registers.  It may not be
  585.      worth the trouble to describe the values that are stored, but it
  586.      is essential to inform the compiler that the registers will be
  587.      altered, lest it attempt to keep data in them across the string
  588.      instruction.
  589.      If X is `(mem:BLK (const_int 0))', it means that all memory
  590.      locations must be presumed clobbered.
  591.      Note that the machine description classifies certain hard
  592.      registers as "call-clobbered".  All function call instructions are
  593.      assumed by default to clobber these registers, so there is no need
  594.      to use `clobber' expressions to indicate this fact.  Also, each
  595.      function call is assumed to have the potential to alter any memory
  596.      location, unless the function is declared `const'.
  597.      If the last group of expressions in a `parallel' are each a
  598.      `clobber' expression whose arguments are `reg' or `match_scratch'
  599.      (*note RTL Template::.) expressions, the combiner phase can add
  600.      the appropriate `clobber' expressions to an insn it has
  601.      constructed when doing so will cause a pattern to be matched.
  602.      This feature can be used, for example, on a machine that whose
  603.      multiply and add instructions don't use an MQ register but which
  604.      has an add-accumulate instruction that does clobber the MQ
  605.      register.  Similarly, a combined instruction might require a
  606.      temporary register while the constituent instructions might not.
  607.      When a `clobber' expression for a register appears inside a
  608.      `parallel' with other side effects, the register allocator
  609.      guarantees that the register is unoccupied both before and after
  610.      that insn.  However, the reload phase may allocate a register used
  611.      for one of the inputs unless the `&' constraint is specified for
  612.      the selected alternative (*note Modifiers::.).  You can clobber
  613.      either a specific hard register, a pseudo register, or a `scratch'
  614.      expression; in the latter two cases, GNU CC will allocate a hard
  615.      register that is available there for use as a temporary.
  616.      For instructions that require a temporary register, you should use
  617.      `scratch' instead of a pseudo-register because this will allow the
  618.      combiner phase to add the `clobber' when required.  You do this by
  619.      coding (`clobber' (`match_scratch' ...)).  If you do clobber a
  620.      pseudo register, use one which appears nowhere else--generate a
  621.      new one each time.  Otherwise, you may confuse CSE.
  622.      There is one other known use for clobbering a pseudo register in a
  623.      `parallel': when one of the input operands of the insn is also
  624.      clobbered by the insn.  In this case, using the same pseudo
  625.      register in the clobber and elsewhere in the insn produces the
  626.      expected results.
  627. `(use X)'
  628.      Represents the use of the value of X.  It indicates that the value
  629.      in X at this point in the program is needed, even though it may
  630.      not be apparent why this is so.  Therefore, the compiler will not
  631.      attempt to delete previous instructions whose only effect is to
  632.      store a value in X.  X must be a `reg' expression.
  633.      During the delayed branch scheduling phase, X may be an insn.
  634.      This indicates that X previously was located at this place in the
  635.      code and its data dependencies need to be taken into account.
  636.      These `use' insns will be deleted before the delayed branch
  637.      scheduling phase exits.
  638. `(parallel [X0 X1 ...])'
  639.      Represents several side effects performed in parallel.  The square
  640.      brackets stand for a vector; the operand of `parallel' is a vector
  641.      of expressions.  X0, X1 and so on are individual side effect
  642.      expressions--expressions of code `set', `call', `return',
  643.      `clobber' or `use'.
  644.      "In parallel" means that first all the values used in the
  645.      individual side-effects are computed, and second all the actual
  646.      side-effects are performed.  For example,
  647.           (parallel [(set (reg:SI 1) (mem:SI (reg:SI 1)))
  648.                      (set (mem:SI (reg:SI 1)) (reg:SI 1))])
  649.      says unambiguously that the values of hard register 1 and the
  650.      memory location addressed by it are interchanged.  In both places
  651.      where `(reg:SI 1)' appears as a memory address it refers to the
  652.      value in register 1 *before* the execution of the insn.
  653.      It follows that it is *incorrect* to use `parallel' and expect the
  654.      result of one `set' to be available for the next one.  For
  655.      example, people sometimes attempt to represent a jump-if-zero
  656.      instruction this way:
  657.           (parallel [(set (cc0) (reg:SI 34))
  658.                      (set (pc) (if_then_else
  659.                                   (eq (cc0) (const_int 0))
  660.                                   (label_ref ...)
  661.                                   (pc)))])
  662.      But this is incorrect, because it says that the jump condition
  663.      depends on the condition code value *before* this instruction, not
  664.      on the new value that is set by this instruction.
  665.      Peephole optimization, which takes place together with final
  666.      assembly code output, can produce insns whose patterns consist of
  667.      a `parallel' whose elements are the operands needed to output the
  668.      resulting assembler code--often `reg', `mem' or constant
  669.      expressions.  This would not be well-formed RTL at any other stage
  670.      in compilation, but it is ok then because no further optimization
  671.      remains to be done.  However, the definition of the macro
  672.      `NOTICE_UPDATE_CC', if any, must deal with such insns if you
  673.      define any peephole optimizations.
  674. `(sequence [INSNS ...])'
  675.      Represents a sequence of insns.  Each of the INSNS that appears in
  676.      the vector is suitable for appearing in the chain of insns, so it
  677.      must be an `insn', `jump_insn', `call_insn', `code_label',
  678.      `barrier' or `note'.
  679.      A `sequence' RTX is never placed in an actual insn during RTL
  680.      generation.  It represents the sequence of insns that result from a
  681.      `define_expand' *before* those insns are passed to `emit_insn' to
  682.      insert them in the chain of insns.  When actually inserted, the
  683.      individual sub-insns are separated out and the `sequence' is
  684.      forgotten.
  685.      After delay-slot scheduling is completed, an insn and all the
  686.      insns that reside in its delay slots are grouped together into a
  687.      `sequence'.  The insn requiring the delay slot is the first insn
  688.      in the vector; subsequent insns are to be placed in the delay slot.
  689.      `INSN_ANNULLED_BRANCH_P' is set on an insn in a delay slot to
  690.      indicate that a branch insn should be used that will conditionally
  691.      annul the effect of the insns in the delay slots.  In such a case,
  692.      `INSN_FROM_TARGET_P' indicates that the insn is from the target of
  693.      the branch and should be executed only if the branch is taken;
  694.      otherwise the insn should be executed only if the branch is not
  695.      taken.  *Note Delay Slots::.
  696.    These expression codes appear in place of a side effect, as the body
  697. of an insn, though strictly speaking they do not always describe side
  698. effects as such:
  699. `(asm_input S)'
  700.      Represents literal assembler code as described by the string S.
  701. `(unspec [OPERANDS ...] INDEX)'
  702. `(unspec_volatile [OPERANDS ...] INDEX)'
  703.      Represents a machine-specific operation on OPERANDS.  INDEX
  704.      selects between multiple machine-specific operations.
  705.      `unspec_volatile' is used for volatile operations and operations
  706.      that may trap; `unspec' is used for other operations.
  707.      These codes may appear inside a `pattern' of an insn, inside a
  708.      `parallel', or inside an expression.
  709. `(addr_vec:M [LR0 LR1 ...])'
  710.      Represents a table of jump addresses.  The vector elements LR0,
  711.      etc., are `label_ref' expressions.  The mode M specifies how much
  712.      space is given to each address; normally M would be `Pmode'.
  713. `(addr_diff_vec:M BASE [LR0 LR1 ...])'
  714.      Represents a table of jump addresses expressed as offsets from
  715.      BASE.  The vector elements LR0, etc., are `label_ref' expressions
  716.      and so is BASE.  The mode M specifies how much space is given to
  717.      each address-difference.
  718. File: gcc.info,  Node: Incdec,  Next: Assembler,  Prev: Side Effects,  Up: RTL
  719. Embedded Side-Effects on Addresses
  720. ==================================
  721.    Four special side-effect expression codes appear as memory addresses.
  722. `(pre_dec:M X)'
  723.      Represents the side effect of decrementing X by a standard amount
  724.      and represents also the value that X has after being decremented.
  725.      x must be a `reg' or `mem', but most machines allow only a `reg'.
  726.      m must be the machine mode for pointers on the machine in use.
  727.      The amount X is decremented by is the length in bytes of the
  728.      machine mode of the containing memory reference of which this
  729.      expression serves as the address.  Here is an example of its use:
  730.           (mem:DF (pre_dec:SI (reg:SI 39)))
  731.      This says to decrement pseudo register 39 by the length of a
  732.      `DFmode' value and use the result to address a `DFmode' value.
  733. `(pre_inc:M X)'
  734.      Similar, but specifies incrementing X instead of decrementing it.
  735. `(post_dec:M X)'
  736.      Represents the same side effect as `pre_dec' but a different
  737.      value.  The value represented here is the value X has before being
  738.      decremented.
  739. `(post_inc:M X)'
  740.      Similar, but specifies incrementing X instead of decrementing it.
  741.    These embedded side effect expressions must be used with care.
  742. Instruction patterns may not use them.  Until the `flow' pass of the
  743. compiler, they may occur only to represent pushes onto the stack.  The
  744. `flow' pass finds cases where registers are incremented or decremented
  745. in one instruction and used as an address shortly before or after;
  746. these cases are then transformed to use pre- or post-increment or
  747. -decrement.
  748.    If a register used as the operand of these expressions is used in
  749. another address in an insn, the original value of the register is used.
  750. Uses of the register outside of an address are not permitted within the
  751. same insn as a use in an embedded side effect expression because such
  752. insns behave differently on different machines and hence must be treated
  753. as ambiguous and disallowed.
  754.    An instruction that can be represented with an embedded side effect
  755. could also be represented using `parallel' containing an additional
  756. `set' to describe how the address register is altered.  This is not
  757. done because machines that allow these operations at all typically
  758. allow them wherever a memory address is called for.  Describing them as
  759. additional parallel stores would require doubling the number of entries
  760. in the machine description.
  761. File: gcc.info,  Node: Assembler,  Next: Insns,  Prev: Incdec,  Up: RTL
  762. Assembler Instructions as Expressions
  763. =====================================
  764.    The RTX code `asm_operands' represents a value produced by a
  765. user-specified assembler instruction.  It is used to represent an `asm'
  766. statement with arguments.  An `asm' statement with a single output
  767. operand, like this:
  768.      asm ("foo %1,%2,%0" : "=a" (outputvar) : "g" (x + y), "di" (*z));
  769. is represented using a single `asm_operands' RTX which represents the
  770. value that is stored in `outputvar':
  771.      (set RTX-FOR-OUTPUTVAR
  772.           (asm_operands "foo %1,%2,%0" "a" 0
  773.                         [RTX-FOR-ADDITION-RESULT RTX-FOR-*Z]
  774.                         [(asm_input:M1 "g")
  775.                          (asm_input:M2 "di")]))
  776. Here the operands of the `asm_operands' RTX are the assembler template
  777. string, the output-operand's constraint, the index-number of the output
  778. operand among the output operands specified, a vector of input operand
  779. RTX's, and a vector of input-operand modes and constraints.  The mode
  780. M1 is the mode of the sum `x+y'; M2 is that of `*z'.
  781.    When an `asm' statement has multiple output values, its insn has
  782. several such `set' RTX's inside of a `parallel'.  Each `set' contains a
  783. `asm_operands'; all of these share the same assembler template and
  784. vectors, but each contains the constraint for the respective output
  785. operand.  They are also distinguished by the output-operand index
  786. number, which is 0, 1, ... for successive output operands.
  787.